<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/*
<span class='line'>  2</span>  * $Id: om-tabs.js,v 1.110 2012/06/28 06:35:42 chentianzhen Exp $
<span class='line'>  3</span>  * operamasks-ui omTabs @VERSION
<span class='line'>  4</span>  *
<span class='line'>  5</span>  * Copyright 2011, AUTHORS.txt (http://ui.operamasks.org/about)
<span class='line'>  6</span>  * Dual licensed under the MIT or LGPL Version 2 licenses.
<span class='line'>  7</span>  * http://ui.operamasks.org/license
<span class='line'>  8</span>  *
<span class='line'>  9</span>  * http://ui.operamasks.org/docs/
<span class='line'> 10</span>  *
<span class='line'> 11</span>  * Depends:
<span class='line'> 12</span>  *  om-panel.js
<span class='line'> 13</span>  */</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="COMM">/**
<span class='line'> 15</span>  * $.fn.omTabs
<span class='line'> 16</span>  * 将如下html结构转变成一个tab页签布局。
<span class='line'> 17</span>  *      &lt;div id="make-tab">
<span class='line'> 18</span>  *          &lt;ul>
<span class='line'> 19</span>  *              &lt;li>
<span class='line'> 20</span>  *                  &lt;a href="#tab1">&lt;/a>
<span class='line'> 21</span>  *              &lt;/li>
<span class='line'> 22</span>  *              &lt;li>
<span class='line'> 23</span>  *                  &lt;a href="#tab2">&lt;/a>
<span class='line'> 24</span>  *              &lt;/li>
<span class='line'> 25</span>  *              &lt;li>
<span class='line'> 26</span>  *                  &lt;a href="#tab3">&lt;/a>
<span class='line'> 27</span>  *              &lt;/li>
<span class='line'> 28</span>  *          &lt;/ul>
<span class='line'> 29</span>  *          &lt;div id="tab1">
<span class='line'> 30</span>  *              this is tab1 content
<span class='line'> 31</span>  *          &lt;/div>
<span class='line'> 32</span>  *          &lt;div id="tab2">
<span class='line'> 33</span>  *              this is tab2 content
<span class='line'> 34</span>  *          &lt;/div>
<span class='line'> 35</span>  *          &lt;div id="tab3">
<span class='line'> 36</span>  *              this is tab3 content
<span class='line'> 37</span>  *          &lt;/div>
<span class='line'> 38</span>  *      &lt;/div>
<span class='line'> 39</span>  *          ......//some other stuff
<span class='line'> 40</span>  *      
<span class='line'> 41</span>  *  最终的dom结构如下所示：
<span class='line'> 42</span>  * 
<span class='line'> 43</span>  *      &lt;div id="make-tab" class="om-tabs">
<span class='line'> 44</span>  *          &lt;div class="om-tabs-headers">
<span class='line'> 45</span>  *              &lt;ul>
<span class='line'> 46</span>  *                  &lt;li>
<span class='line'> 47</span>  *                      &lt;a href="#tab1">&lt;/a>
<span class='line'> 48</span>  *                  &lt;/li>
<span class='line'> 49</span>  *                  &lt;li>
<span class='line'> 50</span>  *                      &lt;a href="#tab2">&lt;/a>
<span class='line'> 51</span>  *                  &lt;/li>
<span class='line'> 52</span>  *                  &lt;li>
<span class='line'> 53</span>  *                      &lt;a href="#tab3">&lt;/a>
<span class='line'> 54</span>  *                  &lt;/li>
<span class='line'> 55</span>  *              &lt;/ul>
<span class='line'> 56</span>  *          &lt;/div>
<span class='line'> 57</span>  *          &lt;div class="om-tabs-panels">
<span class='line'> 58</span>  *              &lt;div id="tab1">
<span class='line'> 59</span>  *                  this is tab1 content
<span class='line'> 60</span>  *              &lt;/div>
<span class='line'> 61</span>  *              &lt;div id="tab2">
<span class='line'> 62</span>  *                  this is tab2 content
<span class='line'> 63</span>  *              &lt;/div>
<span class='line'> 64</span>  *              &lt;div id="tab3">
<span class='line'> 65</span>  *                  this is tab3 content
<span class='line'> 66</span>  *              &lt;/div>
<span class='line'> 67</span>  *          &lt;/div>
<span class='line'> 68</span>  *      
<span class='line'> 69</span>  *      &lt;/div>
<span class='line'> 70</span>  * 
<span class='line'> 71</span>  */</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tabIdPrefix</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'om-tabs-'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">+</span><span class="NAME">Math.random</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">*</span><span class="NUMB">0x10000</span><span class="PUNC">)</span><span class="PUNC">|</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toString</span><span class="PUNC">(</span><span class="NUMB">16</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">substring</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'-'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">        </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">activatedCls</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"om-tabs-activated om-state-active"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">        </span><span class="NAME">scrollDisabled</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"om-tabs-scroll-disabled"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 78</span>      * class OmPanel， 在target指定的地方根据config生成一个Panel， 该类是$.fn.omPanel包装器。
<span class='line'> 79</span>      * param target dom元素，一般指向一个div。
<span class='line'> 80</span>      * param config 生成Panel所需要的配置项，如果设置了content属性，则使用其为内容将会被传递给 $.fn.omPanel。
<span class='line'> 81</span>      * return 原先的target
<span class='line'> 82</span>      */</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">    </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">OmPanel</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">html</span><span class="PUNC">(</span><span class="NAME">config.content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="NAME">config</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 89</span> 
<span class='line'> 90</span> </span><span class="WHIT">    </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">isIE7</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">$.browser.msie</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">parseInt</span><span class="PUNC">(</span><span class="NAME">$.browser.version</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">7</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 95</span>      * @name omTabs
<span class='line'> 96</span>      * @class 页签布局组件，通过简单的配置展示多页签信息，同时组件提供丰富的事件支持，比如选中页签，关闭页签，添加页签等等。&lt;br/>
<span class='line'> 97</span>      * 支持各个页签以ajax方式加载内容；支持懒加载；支持页签滚动。&lt;br/>
<span class='line'> 98</span>      * &lt;b>使用方式：&lt;/b>&lt;br/>&lt;br/>
<span class='line'> 99</span>      * 页面上的html标记如下
<span class='line'>100</span>      * &lt;pre>
<span class='line'>101</span>      * &lt;script type="text/javascript" >
<span class='line'>102</span>      * $(document).ready(function() {
<span class='line'>103</span>      *     $('#make-tab').omTabs({});
<span class='line'>104</span>      * });
<span class='line'>105</span>      * &lt;/script>
<span class='line'>106</span>      * 
<span class='line'>107</span>      *      &lt;div id="make-tab"&gt;
<span class='line'>108</span>      *          &lt;ul&gt;
<span class='line'>109</span>      *              &lt;li&gt;
<span class='line'>110</span>      *                  &lt;a href="#tab1"&gt;Title1&lt;/a&gt;
<span class='line'>111</span>      *              &lt;/li&gt;
<span class='line'>112</span>      *              &lt;li&gt;
<span class='line'>113</span>      *                  &lt;a href="#tab2"&gt;Title2&lt;/a&gt;
<span class='line'>114</span>      *              &lt;/li&gt;
<span class='line'>115</span>      *              &lt;li&gt;
<span class='line'>116</span>      *                  &lt;a href="#tab3"&gt;Title3&lt;/a&gt;
<span class='line'>117</span>      *              &lt;/li&gt;
<span class='line'>118</span>      *          &lt;/ul&gt;
<span class='line'>119</span>      *          &lt;div id="tab1"&gt;
<span class='line'>120</span>      *              this is tab1 content
<span class='line'>121</span>      *          &lt;/div&gt;
<span class='line'>122</span>      *          &lt;div id="tab2"&gt;
<span class='line'>123</span>      *              this is tab2 content
<span class='line'>124</span>      *          &lt;/div&gt;
<span class='line'>125</span>      *          &lt;div id="tab3"&gt;
<span class='line'>126</span>      *              this is tab3 content
<span class='line'>127</span>      *          &lt;/div&gt;
<span class='line'>128</span>      *      &lt;/div&gt;
<span class='line'>129</span>      * &lt;/pre>
<span class='line'>130</span>      * @constructor
<span class='line'>131</span>      * @description 构造函数
<span class='line'>132</span>      * @param p 标准config对象：{width:500, height:300}
<span class='line'>133</span>      * @example
<span class='line'>134</span>      * $('#make-tab').omTabs({width:500, height:300});
<span class='line'>135</span>      */</span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">    </span><span class="NAME">$.omWidget</span><span class="PUNC">(</span><span class="STRN">'om.omTabs'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">        </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">/** @lends omTabs#*/</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>139</span>              * 页签布局的宽度，可取值为'auto'(默认情况，不做处理)，可以取值为'fit'，表示适应父容器的大小(width:100%)，也可以直接设置width大小（单位：像素）。
<span class='line'>140</span>              * @default 'auto'
<span class='line'>141</span>              * @type Number,String
<span class='line'>142</span>              * @example
<span class='line'>143</span>              * $('#make-tab').omTabs({width: 500});
<span class='line'>144</span>              */</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">            </span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'auto'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>147</span>              * 页签布局的高度，可取值为'auto'(默认情况，不做处理)，可以取值为'fit'，表示适应父容器的大小(height:100%)，也可以直接设置height大小（单位：像素）。
<span class='line'>148</span>              * @default 'auto'
<span class='line'>149</span>              * @type Number,String
<span class='line'>150</span>              * @example
<span class='line'>151</span>              * $('#make-tab').omTabs({height: 200});
<span class='line'>152</span>              */</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">            </span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'auto'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>155</span>              * 是否显示页签正文区的边框。
<span class='line'>156</span>              * @default true
<span class='line'>157</span>              * @type Boolean
<span class='line'>158</span>              * @example
<span class='line'>159</span>              * $('#make-tab').omTabs({border: false});//不显示页签正文区的边框
<span class='line'>160</span>              */</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">            </span><span class="NAME">border</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>163</span>              * 单个页签头部的宽度。
<span class='line'>164</span>              * @default auto
<span class='line'>165</span>              * @type Number,String
<span class='line'>166</span>              * @example
<span class='line'>167</span>              * $('#make-tab').omTabs({tabWidth: 'auto'});
<span class='line'>168</span>              */</span><span class="WHIT">
<span class='line'>169</span> </span><span class="WHIT">            </span><span class="NAME">tabWidth</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'auto'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>170</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>171</span>              * 单个页签头部的高度，可取值为'auto'。默认为25像素。
<span class='line'>172</span>              * @default 25
<span class='line'>173</span>              * @type Number,String
<span class='line'>174</span>              * @example
<span class='line'>175</span>              * $('#make-tab').omTabs({tabHeight: 'auto'});
<span class='line'>176</span>              */</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT">            </span><span class="NAME">tabHeight</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">27</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>179</span>              * 当页签超过组件宽度时是否出现左右滚动箭头。
<span class='line'>180</span>              * @default true
<span class='line'>181</span>              * @type Boolean
<span class='line'>182</span>              * @example
<span class='line'>183</span>              * //当页签数目较多时不显示滚动箭头，将访问不到未显示的页签
<span class='line'>184</span>              * $('#make-tab').omTabs({scrollable: false});
<span class='line'>185</span>              */</span><span class="WHIT">
<span class='line'>186</span> </span><span class="WHIT">            </span><span class="NAME">scrollable</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>188</span>              * 页签是否可关闭，当本属性为true时，所有页签都可以关闭。当属性值为数组时，只有数组中指定的index的页签可以关闭，index从0开始。
<span class='line'>189</span>              * @default false
<span class='line'>190</span>              * @type Boolean,Array
<span class='line'>191</span>              * @example
<span class='line'>192</span>              * //页签可关闭
<span class='line'>193</span>              * $('#make-tab').omTabs({closable : true});
<span class='line'>194</span>              * 
<span class='line'>195</span>              * //只有第一个和第三个页签可以关闭
<span class='line'>196</span>              * $('#make-tab').omTabs({closable : [0,2]);
<span class='line'>197</span>              */</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">            </span><span class="NAME">closable</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">            </span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">            </span><span class="COMM">//  暂时不公布</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">            </span><span class="COMM">//  页签头部的位置，可为top和left //TODO 'left'</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">            </span><span class="COMM">// @default 'top'</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">            </span><span class="COMM">// @type String</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">            </span><span class="COMM">// @example</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT">            </span><span class="COMM">// $('#make-tab').omTabs({position : 'left'});//页签头部在组件的左边</span><span class="WHIT">
<span class='line'>206</span> </span><span class="WHIT">            </span><span class="COMM">//</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT">            </span><span class="NAME">position</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'top'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>209</span>              * 页签切换的模式。可为click(鼠标点击切换)，mouseover(鼠标滑过切换)。&lt;b>注意：当设置了autoPlay属性时，虽然组件在自动切换，此时仍可以使用鼠标点击（鼠标划过）切换页签&lt;/b>
<span class='line'>210</span>              * @default 'click'
<span class='line'>211</span>              * @type String
<span class='line'>212</span>              * @example
<span class='line'>213</span>              * $('#make-tab').omTabs({switchMode : 'mouseover'});//鼠标划过切换页签
<span class='line'>214</span>              */</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">            </span><span class="NAME">switchMode</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'click'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>217</span>              * 是否自动循环切换页签。
<span class='line'>218</span>              * @default false
<span class='line'>219</span>              * @type Boolean
<span class='line'>220</span>              * @example
<span class='line'>221</span>              * $('#make-tab').omTabs({autoPlay:true});//自动切换页签
<span class='line'>222</span>              */</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">            </span><span class="NAME">autoPlay</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>225</span>              * 自动切换页签的时间间隔，单位为毫秒。 该属性在 switchMode 为auto时才生效。
<span class='line'>226</span>              * @default 1000
<span class='line'>227</span>              * @type Number
<span class='line'>228</span>              * @example
<span class='line'>229</span>              * $('#make-tab').omTabs({autoPlay:true, interval : 2000});//自动切换页签时，时间间隔为2s
<span class='line'>230</span>              */</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">            </span><span class="NAME">interval</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>233</span>              * 初始化时被激活页签的索引（从0开始计数）或者tabId。
<span class='line'>234</span>              * @default 0
<span class='line'>235</span>              * @type Number,String
<span class='line'>236</span>              * @example
<span class='line'>237</span>              * $('#make-tab').omTabs({active : 1});//初始化时激活第二个页签
<span class='line'>238</span>              * $('#make-tab').omTabs({active : 'tab-1'});//初始化时激活Id为'tab-1'的页签
<span class='line'>239</span>              */</span><span class="WHIT">
<span class='line'>240</span> </span><span class="WHIT">            </span><span class="NAME">active</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>241</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>242</span>              * 是否懒加载，当该属性为true时，只有在页签被单击选中时才尝试加载页签正文区。
<span class='line'>243</span>              * @default false
<span class='line'>244</span>              * @type Boolean
<span class='line'>245</span>              * @example
<span class='line'>246</span>              * $('#make-tab').omTabs({lazyLoad : true});
<span class='line'>247</span>              */</span><span class="WHIT">
<span class='line'>248</span> </span><span class="WHIT">            </span><span class="NAME">lazyLoad</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>249</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>250</span>              * 是否显示操作menu，设置为true则可以在tab页签上面点击右键出现关闭等操作下拉框。
<span class='line'>251</span>              * @default false
<span class='line'>252</span>              * @type Boolean
<span class='line'>253</span>              * @example
<span class='line'>254</span>              * $('#make-tab').omTabs({contextMenu : true});
<span class='line'>255</span>              */</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">            </span><span class="NAME">tabMenu</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>257</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>258</span>              * 当页签被选中之前执行的方法。
<span class='line'>259</span>              * @event
<span class='line'>260</span>              * @param n 选中页签的索引，从0开始计数.
<span class='line'>261</span>              * @param event jQuery.Event对象
<span class='line'>262</span>              * @default emptyFn 
<span class='line'>263</span>              * @example
<span class='line'>264</span>              *  $('#make-tab').omTabs({
<span class='line'>265</span>              *      onBeforeActivate : function(n,event) {
<span class='line'>266</span>              *          alert('tab ' + n + ' will be activated!');
<span class='line'>267</span>              *      }
<span class='line'>268</span>              *  });
<span class='line'>269</span>              */</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">            </span><span class="NAME">onBeforeActivate</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>273</span>              * 当页签被选中后执行的方法。
<span class='line'>274</span>              * @event
<span class='line'>275</span>              * @param n 选中页签的索引，从0开始计数.
<span class='line'>276</span>              * @param event jQuery.Event对象
<span class='line'>277</span>              * @default emptyFn 
<span class='line'>278</span>              * @example
<span class='line'>279</span>              *  $('#make-tab').omTabs({
<span class='line'>280</span>              *      onActivate : function(n,event) {
<span class='line'>281</span>              *          alert('tab ' + n + ' has been activated!');
<span class='line'>282</span>              *      }
<span class='line'>283</span>              *  });
<span class='line'>284</span>              */</span><span class="WHIT">
<span class='line'>285</span> </span><span class="WHIT">            </span><span class="NAME">onActivate</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>288</span>              * 当页签被关闭之前执行的方法。
<span class='line'>289</span>              * @event
<span class='line'>290</span>              * @param n 被关闭页签的索引，从0开始计数。
<span class='line'>291</span>              * @param event jQuery.Event对象
<span class='line'>292</span>              * @default emptyFn 
<span class='line'>293</span>              * @example
<span class='line'>294</span>              *  $('#make-tab').omTabs({
<span class='line'>295</span>              *      onBeforeClose : function(n,event) {
<span class='line'>296</span>              *          alert('tab ' + n + ' will be closed!');
<span class='line'>297</span>              *      }
<span class='line'>298</span>              *  });
<span class='line'>299</span>              */</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">            </span><span class="NAME">onBeforeClose</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>303</span>              * 当页签被关闭之后执行的方法。
<span class='line'>304</span>              * @event
<span class='line'>305</span>              * @param n 被关闭页签的索引，从0开始计数。
<span class='line'>306</span>              * @param event jQuery.Event对象
<span class='line'>307</span>              * @default emptyFn 
<span class='line'>308</span>              * @example
<span class='line'>309</span>              *  $('#make-tab').omTabs({
<span class='line'>310</span>              *      onClose : function(n,event) {
<span class='line'>311</span>              *          alert('tab ' + n + ' has been closed!');
<span class='line'>312</span>              *      }
<span class='line'>313</span>              *  });
<span class='line'>314</span>              */</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">            </span><span class="NAME">onClose</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>318</span>              * 当关闭所有页签之前执行的方法。
<span class='line'>319</span>              * @event
<span class='line'>320</span>              * @param event jQuery.Event对象
<span class='line'>321</span>              * @default emptyFn 
<span class='line'>322</span>              * @example
<span class='line'>323</span>              *  $('#make-tab').omTabs({
<span class='line'>324</span>              *      onBeforeCloseAll : function(event) {
<span class='line'>325</span>              *          alert('all tabs will be closed !');
<span class='line'>326</span>              *      }
<span class='line'>327</span>              *  });
<span class='line'>328</span>              */</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">            </span><span class="NAME">onBeforeCloseAll</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>332</span>              * 当关闭所有页签之后执行的方法。
<span class='line'>333</span>              * @event
<span class='line'>334</span>              * @param event jQuery.Event对象
<span class='line'>335</span>              * @default emptyFn 
<span class='line'>336</span>              * @example
<span class='line'>337</span>              *  $('#make-tab').omTabs({
<span class='line'>338</span>              *      onCloseAll : function(event) {
<span class='line'>339</span>              *          alert('tabs are all closed now !');
<span class='line'>340</span>              *      }
<span class='line'>341</span>              *  });
<span class='line'>342</span>              */</span><span class="WHIT">
<span class='line'>343</span> </span><span class="WHIT">            </span><span class="NAME">onCloseAll</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>346</span>              * 当新页签被添加之后执行的方法。
<span class='line'>347</span>              * @event
<span class='line'>348</span>              * @default emptyFn 
<span class='line'>349</span>              * @param config 经过处理的配置项。在调用add新增页签时，传入的配置项参数可能不完整(使用默认值)，此处的config就是完整的配置项
<span class='line'>350</span>              * @param event jQuery.Event对象
<span class='line'>351</span>              * @example
<span class='line'>352</span>              *  $('#make-tab').omTabs({
<span class='line'>353</span>              *      onAdd : function(config,event) {
<span class='line'>354</span>              *          console.dir(config);
<span class='line'>355</span>              *          alert('you have added a tab at position:' + config.index );
<span class='line'>356</span>              *      }
<span class='line'>357</span>              *  });
<span class='line'>358</span>              */</span><span class="WHIT">
<span class='line'>359</span> </span><span class="WHIT">            </span><span class="NAME">onAdd</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">config</span><span class="COMM">/*title, content, url, closable , index*/</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>360</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>361</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>362</span>              * 当新页签被添加之前执行的方法。
<span class='line'>363</span>              * @event
<span class='line'>364</span>              * @default emptyFn 
<span class='line'>365</span>              * @param config 经过处理的配置项。在调用add新增页签时，传入的配置项参数可能不完整(使用默认值)，此处的config就是完整的配置项
<span class='line'>366</span>              * @param event jQuery.Event对象
<span class='line'>367</span>              * @example
<span class='line'>368</span>              *  $('#make-tab').omTabs({
<span class='line'>369</span>              *      onBeforeAdd : function(config,event) {
<span class='line'>370</span>              *          console.dir(config);
<span class='line'>371</span>              *          alert('you will add a tab at position:' + index );
<span class='line'>372</span>              *      }
<span class='line'>373</span>              *  });
<span class='line'>374</span>              */</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT">            </span><span class="NAME">onBeforeAdd</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">config</span><span class="COMM">/*title, content, url, closable , index*/</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>377</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>378</span>              * 当页签使用ajax方式加载内容，加载完成后执行的方法。
<span class='line'>379</span>              * @event
<span class='line'>380</span>              * @default emptyFn
<span class='line'>381</span>              * @param tabId 刚加载完成的页签的tabId
<span class='line'>382</span>              * @param event jQuery.Event对象
<span class='line'>383</span>              * @example
<span class='line'>384</span>              *  $('#make-tab').omTabs({
<span class='line'>385</span>              *      onLoadComplete : function(tabId,event) {
<span class='line'>386</span>              *          alert(tabId + 'has just been loaded!' );
<span class='line'>387</span>              *      }
<span class='line'>388</span>              *  });
<span class='line'>389</span>              */</span><span class="WHIT">
<span class='line'>390</span> </span><span class="WHIT">            </span><span class="NAME">onLoadComplete</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="PUNC">,</span><span class="NAME">event</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>394</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>395</span>          * 在index处增加一个tab页签。参数为json格式的配置项。 调用该方法会触发 add事件。
<span class='line'>396</span>          * 配置项参数：
<span class='line'>397</span>          * &lt;ol>
<span class='line'>398</span>          * &lt;li>index：新增页签的位置（从0开始计数,默认在末尾增加页签），可设置为'last'&lt;/li>
<span class='line'>399</span>          * &lt;li>title：新增页签的标题，默认值为 'New Title' + 全局唯一字符串&lt;/li>
<span class='line'>400</span>          * &lt;li>content：新增页签的内容，默认值为 'New Content' + 全局唯一字符串&lt;/li>
<span class='line'>401</span>          * &lt;li>url：新增页签的数据源为url。如果同时设置了content和url，则优先使用url&lt;/li>
<span class='line'>402</span>          * &lt;li>tabId：设置tabId，作为唯一标识，可以通过此标识唯一确定一个tab页签，tabId不能重复&lt;/li>
<span class='line'>403</span>          * &lt;li>closable：该新增的页签是否可关闭。&lt;/li>
<span class='line'>404</span>          * &lt;li>activateNew: 是否同时打开新添加的页签，默认为true&lt;/li>
<span class='line'>405</span>          * &lt;/ol>
<span class='line'>406</span>          * @name omTabs#add
<span class='line'>407</span>          * @function
<span class='line'>408</span>          * @param Object {index,title,content,url,colsable,tabId,activateNew}
<span class='line'>409</span>          * @example
<span class='line'>410</span>          * //在第一个页签的位置新增一个页签,该页签的内容是远程数据
<span class='line'>411</span>          * $('#make-tab').omTabs('add', {
<span class='line'>412</span>          *     index : 0,
<span class='line'>413</span>          *     title : 'New Tab1',
<span class='line'>414</span>          *     content : 'New Content1',
<span class='line'>415</span>          *     closable : false
<span class='line'>416</span>          * });
<span class='line'>417</span>          */</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">        </span><span class="COMM">// TODO: index param should support 'first'</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">        </span><span class="NAME">add</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">config</span><span class="WHIT"> </span><span class="COMM">/*title, content, url, closable , index,tabId, activateNew*/</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">            </span><span class="NAME">this._add</span><span class="PUNC">(</span><span class="NAME">config</span><span class="WHIT"> </span><span class="COMM">/*title, content, url, closable , index,tabId, activateNew*/</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>424</span>          * 关闭特定的页签，如果n指向当前页签，则会选中下一页签；如果当前页签是最末尾的页签，则会选中第一个页签。可以看到每关闭一个页签就会分别触发一次close事件和activate事件。
<span class='line'>425</span>          * @name omTabs#close
<span class='line'>426</span>          * @function
<span class='line'>427</span>          * @param n 要关闭的页签的位置（从0开始计数），或者该页签的tabId(一个全局唯一的字符串)。 如果未指定该参数，则默认关闭当前页签。
<span class='line'>428</span>          * @example
<span class='line'>429</span>          * //关闭第一个页签
<span class='line'>430</span>          * $('#make-tab').omTabs('close', 0);
<span class='line'>431</span>          */</span><span class="WHIT">
<span class='line'>432</span> </span><span class="WHIT">        </span><span class="NAME">close</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>433</span> </span><span class="WHIT">            </span><span class="NAME">this._close</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>434</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>435</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>436</span>          * 关闭所有页签，由于该操作只关注于删除所有页签，因此只会触发 onCloseAll事件，而不会逐个触发每个页签的onClose事件。
<span class='line'>437</span>          * @name omTabs#closeAll
<span class='line'>438</span>          * @function
<span class='line'>439</span>          * @example
<span class='line'>440</span>          * //关闭所有页签
<span class='line'>441</span>          * $('#make-tab').omTabs('closeAll');
<span class='line'>442</span>          */</span><span class="WHIT">
<span class='line'>443</span> </span><span class="WHIT">        </span><span class="NAME">closeAll</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>444</span> </span><span class="WHIT">            </span><span class="NAME">this._closeAll</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>445</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>446</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>447</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>448</span>          * 选中特定的页签，触发activate事件。
<span class='line'>449</span>          * @name omTabs#activate
<span class='line'>450</span>          * @function
<span class='line'>451</span>          * @param n 可为页签的索引（从0开始计数），或者页签的tabId
<span class='line'>452</span>          * @example
<span class='line'>453</span>          * //激活第一个页签
<span class='line'>454</span>          * $('#make-tab').omTabs('activate', 0);
<span class='line'>455</span>          */</span><span class="WHIT">
<span class='line'>456</span> </span><span class="WHIT">        </span><span class="NAME">activate</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>457</span> </span><span class="WHIT">            </span><span class="NAME">this._activate</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>458</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>459</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>460</span>          * 页签索引和tabId的转换器。传入其中的一个值，获取另一个值。
<span class='line'>461</span>          * @name omTabs#getAlter
<span class='line'>462</span>          * @function
<span class='line'>463</span>          * @param id 标识符
<span class='line'>464</span>          * @returns 如果id为数字，则表示页签的索引，函数返回页签的tabId；如果id为字符串，则表示该页签的tabId，函数返回页签的索引。
<span class='line'>465</span>          *          如果索引不合法或者id作为tabId时找不到，则统一返回null。
<span class='line'>466</span>          * @example
<span class='line'>467</span>          * //获取第一个页签的tabId
<span class='line'>468</span>          * var tabId = $('#make-tab').omTabs('getAlter', 0);
<span class='line'>469</span>          */</span><span class="WHIT">
<span class='line'>470</span> </span><span class="WHIT">        </span><span class="NAME">getAlter</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>471</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>472</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>473</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>474</span>          * 返回当前选中的页签的tabId。
<span class='line'>475</span>          * @name omTabs#getActivated
<span class='line'>476</span>          * @function
<span class='line'>477</span>          * @returns 当前选中页签的tabId
<span class='line'>478</span>          * @example
<span class='line'>479</span>          * //获取当前选中页签的tabId
<span class='line'>480</span>          * var activatedTabId = $('#make-tab').omTabs('getActivated');
<span class='line'>481</span>          */</span><span class="WHIT">
<span class='line'>482</span> </span><span class="WHIT">        </span><span class="NAME">getActivated</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>483</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._getActivated</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>484</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>485</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>486</span>          * 获得所有页签的数目。
<span class='line'>487</span>          * @name omTabs#getLength
<span class='line'>488</span>          * @function
<span class='line'>489</span>          * @returns 页签的数目
<span class='line'>490</span>          * @example
<span class='line'>491</span>          * //获取页签的总数
<span class='line'>492</span>          * var total = $('#make-tab').omTabs('getLength');
<span class='line'>493</span>          */</span><span class="WHIT">
<span class='line'>494</span> </span><span class="WHIT">        </span><span class="NAME">getLength</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>495</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this._getLength</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>496</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>497</span> </span><span class="WHIT">        </span><span class="COMM">/**(deprecated，建议用reload方法)
<span class='line'>498</span>          * 设置第n个页签的数据源，可为普通文本或者url。注意该方法只是会重置一个当前页签是否已被加载的标记，而不负责实际加载数据，
<span class='line'>499</span>          * 在非懒加载的情况下，需要手动加载数据。在懒加载的情况下，当页签被点击选中时会检查是否已经加载的标记，从而尝试重新加载内容。
<span class='line'>500</span>          * @deprecated
<span class='line'>501</span>          * @name omTabs#setDataSource
<span class='line'>502</span>          * @function
<span class='line'>503</span>          * @param index 被操作页签的索引(从0开始计数)
<span class='line'>504</span>          * @param content 设置了该属性则表示数据源为普通文本。
<span class='line'>505</span>          * @param url 设置了该属性表示数据源是远程url，如果同时设置了content和url，则优先使用url。
<span class='line'>506</span>          * @example
<span class='line'>507</span>          * //设置第一个页签的数据源为远程数据
<span class='line'>508</span>          *  $('#make-tab').omTabs('setDataSource', {
<span class='line'>509</span>          *      index : 0,
<span class='line'>510</span>          *      url : './ajax/content1.html'
<span class='line'>511</span>          *  });
<span class='line'>512</span>          */</span><span class="WHIT">
<span class='line'>513</span> </span><span class="WHIT">        </span><span class="NAME">setDataSource</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">config</span><span class="WHIT"> </span><span class="COMM">/*content, url, index*/</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT">  </span><span class="PUNC">!</span><span class="NAME">config.url</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">            </span><span class="NAME">this._setDataSource</span><span class="PUNC">(</span><span class="NAME">config</span><span class="WHIT"> </span><span class="COMM">/*content, url, index*/</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>520</span>          * 根据新的数据源重新加载某个页签的内容。
<span class='line'>521</span>          * @name omTabs#reload
<span class='line'>522</span>          * @function
<span class='line'>523</span>          * @param index 页签的索引
<span class='line'>524</span>          * @param url 页签为远程取数时的url，此属性优先级高于content
<span class='line'>525</span>          * @param content 页签的文本内容
<span class='line'>526</span>          * @example
<span class='line'>527</span>          * //重新加载第一个页签的内容
<span class='line'>528</span>          * $('#make-tab').omTabs('reload', 0 , "./getData.html");
<span class='line'>529</span>          */</span><span class="WHIT">
<span class='line'>530</span> </span><span class="WHIT">        </span><span class="NAME">reload</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">content</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>531</span> </span><span class="WHIT">            </span><span class="NAME">this._reload</span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>532</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>534</span>          * 对组件重新布局，主要操作是刷新页签滚动箭头。
<span class='line'>535</span>          * 如果有必要使用页签滚动箭头，则刷新滚动箭头的状态。如果没必要使用页签滚动箭头，则将存在的删除。
<span class='line'>536</span>          * @name omTabs#doLayout
<span class='line'>537</span>          * @function
<span class='line'>538</span>          * @example
<span class='line'>539</span>          * //对组件重新布局，如果有必要使用页签滚动箭头，则刷新滚动箭头的状态。
<span class='line'>540</span>          */</span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">        </span><span class="NAME">doLayout</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>542</span> </span><span class="WHIT">            </span><span class="NAME">this._doLayout</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>543</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>544</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>545</span> </span><span class="WHIT">        </span><span class="NAME">_create</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>546</span> </span><span class="WHIT">	        </span><span class="NAME">this._makeSketch</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>547</span> </span><span class="WHIT">            </span><span class="NAME">this._collectItems</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">            </span><span class="NAME">this.history</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="COMM">//页签访问的历史记录</span><span class="WHIT">
<span class='line'>549</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>550</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">        </span><span class="NAME">_init</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">            </span><span class="NAME">this._render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>553</span> </span><span class="WHIT">            </span><span class="NAME">this._afterRender</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">            </span><span class="NAME">this._buildEvent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>556</span> </span><span class="WHIT">        </span><span class="WHIT">
<span class='line'>557</span> </span><span class="WHIT">        </span><span class="NAME">_makeSketch</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>558</span> </span><span class="WHIT">            </span><span class="NAME">this.element.addClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs om-widget om-widget-content om-corner-all'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>559</span> </span><span class="WHIT">                </span><span class="PUNC">.</span><span class="NAME">append</span><span class="PUNC">(</span><span class="STRN">'&lt;div class="om-tabs-panels om-widget-content om-corner-bottom" />'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>560</span> </span><span class="WHIT">                </span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'>ul'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">wrap</span><span class="PUNC">(</span><span class="STRN">'&lt;div class="om-tabs-headers om-helper-reset om-helper-clearfix om-widget-header om-corner-all" />'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>561</span> </span><span class="WHIT">            </span><span class="NAME">this.$menu</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;div>&lt;/div>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">appendTo</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'body'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>562</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>563</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>564</span> </span><span class="WHIT">    	</span><span class="NAME">_collectItems</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>565</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>566</span> </span><span class="WHIT">	        	</span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>567</span> </span><span class="WHIT">	        	</span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>568</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>569</span> </span><span class="WHIT">	        	</span><span class="NAME">loadInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>570</span> </span><span class="WHIT">	        </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers a'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>571</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">href</span><span class="WHIT">  </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.getAttribute</span><span class="PUNC">(</span><span class="STRN">'href'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>572</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hrefBase</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">href.split</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>573</span> </span><span class="WHIT">	                </span><span class="NAME">baseEl</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>574</span> </span><span class="WHIT">	            </span><span class="COMM">// 如果标签的 href 是类似 http://domain.com/self.html#tab1 的类型，那么需要先去掉"#"的前面 url, 同样需要考虑存在 base 标签的情况</span><span class="WHIT">
<span class='line'>575</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">hrefBase</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">hrefBase</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">location.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"#"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>576</span> </span><span class="WHIT">	                    </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">baseEl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"base"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">[</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">hrefBase</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">baseEl.href</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>577</span> </span><span class="WHIT">	                </span><span class="NAME">href</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.hash</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>578</span> </span><span class="WHIT">	                </span><span class="NAME">this.href</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>579</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>580</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">anchor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>581</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">anchor.attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">anchor.attr</span><span class="PUNC">(</span><span class="STRN">'id'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">tabIdPrefix</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">++</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>582</span> </span><span class="WHIT">	            </span><span class="NAME">anchor.attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>583</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cfg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>584</span> </span><span class="WHIT">	                    </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>585</span> </span><span class="WHIT">	                    </span><span class="NAME">title</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">anchor.text</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>586</span> </span><span class="WHIT">	                    </span><span class="NAME">_closeMode</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"visibility"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>587</span> </span><span class="WHIT">	                    </span><span class="NAME">header</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>588</span> </span><span class="WHIT">	                    </span><span class="NAME">closed</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="COMM">//先全部隐藏.</span><span class="WHIT">
<span class='line'>589</span> </span><span class="WHIT">	                    </span><span class="NAME">onSuccess</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">textStatus</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xmlHttpRequest</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>590</span> </span><span class="WHIT">	        				</span><span class="NAME">_self._trigger</span><span class="PUNC">(</span><span class="STRN">"onLoadComplete"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">cfg.tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>591</span> </span><span class="WHIT">			        	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>592</span> </span><span class="WHIT">			        	</span><span class="NAME">onError</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">xmlHttpRequest</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">textStatus</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">errorThrown</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>593</span> </span><span class="WHIT">			        		</span><span class="NAME">_self._trigger</span><span class="PUNC">(</span><span class="STRN">"onLoadComplete"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">cfg.tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>594</span> </span><span class="WHIT">			        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>595</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>596</span> 
<span class='line'>597</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'>'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>598</span> </span><span class="WHIT">	            </span><span class="WHIT">
<span class='line'>599</span> </span><span class="WHIT">	            </span><span class="COMM">// 考虑到tab DOM结构不完整的情况。</span><span class="WHIT">
<span class='line'>600</span> </span><span class="WHIT">	            </span><span class="COMM">// 例如，当anchor的href='#tab-3'，而用户忘记在tabs里面写id=tab-3的DOM，此时不应该把#tab-3作为url进行load</span><span class="WHIT">
<span class='line'>601</span> </span><span class="WHIT">	            </span><span class="COMM">// http://jira.apusic.net/browse/AOM-204</span><span class="WHIT">
<span class='line'>602</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">href.indexOf</span><span class="PUNC">(</span><span class="STRN">'#'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>603</span> </span><span class="WHIT">	                </span><span class="COMM">//如果是url，并且是非懒加载，则直接交由panel去加载</span><span class="WHIT">
<span class='line'>604</span> </span><span class="WHIT">	                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.lazyLoad</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>605</span> </span><span class="WHIT">	                	</span><span class="NAME">cfg.url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>606</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>607</span> </span><span class="WHIT">	                	</span><span class="NAME">loadInfo.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>608</span> </span><span class="WHIT">	                		</span><span class="NAME">tabId</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>609</span> </span><span class="WHIT">	                		</span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">href</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>610</span> </span><span class="WHIT">	                		</span><span class="NAME">loaded</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>611</span> </span><span class="WHIT">	                	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>612</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>613</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>614</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">OmPanel</span><span class="PUNC">(</span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;div>&lt;/div>'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">cfg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>615</span> </span><span class="WHIT">	            </span><span class="NAME">items.push</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>616</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>617</span> </span><span class="WHIT">            </span><span class="NAME">$lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers ul li'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>618</span> </span><span class="WHIT">	        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="left-placeholder">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertBefore</span><span class="PUNC">(</span><span class="NAME">$lis.eq</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>619</span> </span><span class="WHIT">	        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="right-placeholder">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$lis.eq</span><span class="PUNC">(</span><span class="NAME">$lis.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>620</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">loadInfo.length</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>621</span> </span><span class="WHIT">            	</span><span class="COMM">//一旦存储在loadInfo中，表示该tab还没有进行加载(设置了懒加载)，一旦tab加载完了，相应的要删掉其loadInfo信息</span><span class="WHIT">
<span class='line'>622</span> </span><span class="WHIT">	            </span><span class="NAME">this.loadInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">loadInfo</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>623</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>624</span> </span><span class="WHIT">	        </span><span class="COMM">// tems 是panel的集合.每一个item通过 $(item).omPanel('panel')之后能获取到对应的panel对象</span><span class="WHIT">
<span class='line'>625</span> </span><span class="WHIT">	        </span><span class="NAME">this.items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>626</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>627</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>628</span> </span><span class="WHIT">    	</span><span class="NAME">_render</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>629</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>630</span> </span><span class="WHIT">	            </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>631</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>632</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>633</span> </span><span class="WHIT">	            </span><span class="NAME">$headers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>634</span> </span><span class="WHIT">	        </span><span class="COMM">// 对不合法的值处理</span><span class="WHIT">
<span class='line'>635</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>636</span> </span><span class="WHIT">	        	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>637</span> </span><span class="WHIT">	        		</span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>638</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>639</span> </span><span class="WHIT">	        	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>640</span> </span><span class="WHIT">	        		</span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>641</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>642</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>643</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.border</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>644</span> </span><span class="WHIT">	        	</span><span class="NAME">$self.children</span><span class="PUNC">(</span><span class="STRN">':first'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"header-no-border"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>645</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>646</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.width</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'fit'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>647</span> </span><span class="WHIT">	        	</span><span class="NAME">$self.outerWidth</span><span class="PUNC">(</span><span class="NAME">$self.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>648</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.width</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'auto'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>649</span> </span><span class="WHIT">	            </span><span class="NAME">$self.css</span><span class="PUNC">(</span><span class="STRN">'width'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options.width</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>650</span> </span><span class="WHIT">	            </span><span class="COMM">// 解决IE7下，tabs在table>tr>td中ul把table的宽度撑宽的问题</span><span class="WHIT">
<span class='line'>651</span> </span><span class="WHIT">	</span><span class="COMM">//            omtabs.children(':first').css('width',options.width);</span><span class="WHIT">
<span class='line'>652</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">isPercent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">options.width</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">options.width.indexOf</span><span class="PUNC">(</span><span class="STRN">'%'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>653</span> </span><span class="WHIT">	            </span><span class="NAME">$self.children</span><span class="PUNC">(</span><span class="STRN">':first'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">outerWidth</span><span class="PUNC">(</span><span class="NAME">isPercent</span><span class="PUNC">?</span><span class="STRN">'100%'</span><span class="PUNC">:</span><span class="NAME">options.width</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>654</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>655</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.height</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'fit'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>656</span> </span><span class="WHIT">	        	</span><span class="NAME">$self.outerHeight</span><span class="PUNC">(</span><span class="NAME">$self.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>657</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.height</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="STRN">'auto'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>658</span> </span><span class="WHIT">	            </span><span class="NAME">$self.css</span><span class="PUNC">(</span><span class="STRN">'height'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options.height</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>659</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>660</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>661</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.closable</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">options.tabMenu</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$.fn.omMenu</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>662</span> </span><span class="WHIT">	        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.attr</span><span class="PUNC">(</span><span class="STRN">'id'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>663</span> </span><span class="WHIT">	        	</span><span class="NAME">this.menu</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.$menu.omMenu</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>664</span> </span><span class="WHIT">	        		</span><span class="NAME">contextMenu</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>665</span> </span><span class="WHIT">	        		</span><span class="NAME">dataSource</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">{</span><span class="NAME">id</span><span class="PUNC">:</span><span class="NAME">tabId</span><span class="PUNC">+</span><span class="STRN">'_001'</span><span class="PUNC">,</span><span class="NAME">label</span><span class="PUNC">:</span><span class="STRN">'关闭'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>666</span> </span><span class="WHIT">	                              </span><span class="PUNC">{</span><span class="NAME">id</span><span class="PUNC">:</span><span class="NAME">tabId</span><span class="PUNC">+</span><span class="STRN">'_002'</span><span class="PUNC">,</span><span class="NAME">label</span><span class="PUNC">:</span><span class="STRN">'关闭其它'</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>667</span> </span><span class="WHIT">					        	  </span><span class="PUNC">{</span><span class="NAME">id</span><span class="PUNC">:</span><span class="NAME">tabId</span><span class="PUNC">+</span><span class="STRN">'_003'</span><span class="PUNC">,</span><span class="NAME">label</span><span class="PUNC">:</span><span class="STRN">'关闭所有'</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>668</span> </span><span class="WHIT">	                             </span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>669</span> </span><span class="WHIT">	                </span><span class="NAME">onSelect</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>670</span> </span><span class="WHIT">	                	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.id</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">+</span><span class="STRN">'_001'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>671</span> </span><span class="WHIT">	                		</span><span class="NAME">self.close</span><span class="PUNC">(</span><span class="NAME">self.getAlter</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.$currentLi</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabid'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>672</span> </span><span class="WHIT">	                	</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.id</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">+</span><span class="STRN">'_002'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>673</span> </span><span class="WHIT">	                		</span><span class="NAME">$headers.find</span><span class="PUNC">(</span><span class="STRN">'ul li'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>674</span> </span><span class="WHIT">	                			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">currentLiId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">self.$currentLi</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabid'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>675</span> </span><span class="WHIT">	                			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">itemId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabid'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>676</span> </span><span class="WHIT">	                			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentLiId</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">itemId</span><span class="PUNC">)</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>677</span> </span><span class="WHIT">	                			</span><span class="NAME">self.close</span><span class="PUNC">(</span><span class="NAME">self.getAlter</span><span class="PUNC">(</span><span class="NAME">itemId</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>678</span> </span><span class="WHIT">	                		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>679</span> </span><span class="WHIT">	        			</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">item.id</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">+</span><span class="STRN">'_003'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>680</span> </span><span class="WHIT">	        				</span><span class="NAME">self.closeAll</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>681</span> </span><span class="WHIT">	        			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>682</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>683</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>684</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>685</span> </span><span class="WHIT">	        </span><span class="NAME">this._renderHeader</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>686</span> </span><span class="WHIT">	        </span><span class="NAME">this._renderBody</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>687</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>688</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>689</span> </span><span class="WHIT">		</span><span class="NAME">_renderHeader</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>690</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>691</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>692</span> </span><span class="WHIT">	            </span><span class="NAME">_history</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.history</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>693</span> </span><span class="WHIT">	            </span><span class="NAME">$headers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>694</span> </span><span class="WHIT">	            </span><span class="NAME">$lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$headers.find</span><span class="PUNC">(</span><span class="STRN">'ul li'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>695</span> </span><span class="WHIT">	        </span><span class="NAME">$lis.addClass</span><span class="PUNC">(</span><span class="STRN">'om-state-default om-corner-top'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>696</span> </span><span class="WHIT">	        </span><span class="NAME">$lis.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>697</span> </span><span class="WHIT">	            </span><span class="COMM">//$('a.om-icon-close', $(this)).remove(); 暂时去掉</span><span class="WHIT">
<span class='line'>698</span> </span><span class="WHIT">	            </span><span class="WHIT">
<span class='line'>699</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$innera</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'a:first'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>700</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isIE7</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>701</span> </span><span class="WHIT">	                </span><span class="NAME">$innera.attr</span><span class="PUNC">(</span><span class="STRN">'hideFocus'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'true'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>702</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>703</span> </span><span class="WHIT">	            </span><span class="NAME">$innera.addClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>704</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">$innera.attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>705</span> </span><span class="WHIT">	                </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">activatedCls</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>706</span> </span><span class="WHIT">	                </span><span class="NAME">options.activeTabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$innera.attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>707</span> </span><span class="WHIT">	                </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>708</span> </span><span class="WHIT">	                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">$.inArray</span><span class="PUNC">(</span><span class="NAME">options.activeTabId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">_history</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>709</span> </span><span class="WHIT">	                    </span><span class="NAME">_history.push</span><span class="PUNC">(</span><span class="NAME">options.activeTabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>710</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>711</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>712</span> </span><span class="WHIT">	            	</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="NAME">activatedCls</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>713</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>714</span> </span><span class="WHIT">	            </span><span class="COMM">//tab width and height. by default, tabWidth=auto tabHeight=25, accept 'auto'</span><span class="WHIT">
<span class='line'>715</span> </span><span class="WHIT">	            </span><span class="NAME">$innera.css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>716</span> </span><span class="WHIT">	                </span><span class="STRN">'width'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">options.tabWidth</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>717</span> </span><span class="WHIT">	                </span><span class="STRN">'height'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">options.tabHeight</span><span class="WHIT">
<span class='line'>718</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>719</span> </span><span class="WHIT">	            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="lileft">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertBefore</span><span class="PUNC">(</span><span class="NAME">$innera</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>720</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.closable</span><span class="PUNC">===</span><span class="KEYW">true</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$.isArray</span><span class="PUNC">(</span><span class="NAME">options.closable</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">$.inArray</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">,</span><span class="NAME">options.closable</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>721</span> </span><span class="WHIT">	            	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$innera.next</span><span class="PUNC">(</span><span class="STRN">'.om-icon-close'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>722</span> </span><span class="WHIT">	            		</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;a class="om-icon om-icon-close">&lt;/a>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$innera</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>723</span> </span><span class="WHIT">	            	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>724</span> </span><span class="WHIT">	            	</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="liright">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$innera.next</span><span class="PUNC">(</span><span class="STRN">'.om-icon-close'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>725</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>726</span> </span><span class="WHIT">	            	</span><span class="NAME">$innera.next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>727</span> </span><span class="WHIT">	            	</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="liright">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$innera</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>728</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>729</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>730</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">aHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$lis.find</span><span class="PUNC">(</span><span class="STRN">'a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>731</span> </span><span class="WHIT">	        </span><span class="NAME">$lis.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>732</span> </span><span class="WHIT">	            </span><span class="STRN">'height'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">++</span><span class="WHIT"> </span><span class="NAME">aHeight</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>733</span> </span><span class="WHIT">	            </span><span class="STRN">'line-height'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">aHeight</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'px'</span><span class="WHIT">
<span class='line'>734</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>735</span> </span><span class="WHIT">	        </span><span class="NAME">$headers.height</span><span class="PUNC">(</span><span class="NAME">aHeight</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// 由于有边框，先去掉 +2的设置，适应apusic皮肤</span><span class="WHIT">
<span class='line'>736</span> </span><span class="WHIT">	        </span><span class="NAME">this._checkScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._enableScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>737</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>738</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>739</span> </span><span class="WHIT">		</span><span class="NAME">_renderBody</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>740</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>741</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>742</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>743</span> </span><span class="WHIT">	        	</span><span class="NAME">$panels</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-panels'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>744</span> </span><span class="WHIT">	        </span><span class="COMM">//detach all sub divs</span><span class="WHIT">
<span class='line'>745</span> </span><span class="WHIT">	        </span><span class="NAME">$panels.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">detach</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>746</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>747</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.height</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'auto'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>748</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">omtabsHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.innerHeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>749</span> </span><span class="WHIT">	                </span><span class="NAME">headersHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">outerHeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>750</span> </span><span class="WHIT">	            </span><span class="NAME">$panels.css</span><span class="PUNC">(</span><span class="STRN">'height'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">omtabsHeight</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">headersHeight</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>751</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>752</span> </span><span class="WHIT">	        </span><span class="NAME">$self.toggleClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-noborder'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">options.border</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>753</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>754</span> </span><span class="WHIT">	        </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">--</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>755</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-state-nobd"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">prependTo</span><span class="PUNC">(</span><span class="NAME">$panels</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>756</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>757</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>758</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>759</span> </span><span class="WHIT">    	</span><span class="NAME">_afterRender</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>760</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>761</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>762</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>763</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>764</span> </span><span class="WHIT">	        </span><span class="NAME">$self.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>765</span> </span><span class="WHIT">	            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">is</span><span class="PUNC">(</span><span class="STRN">'.om-tabs-headers,.om-tabs-panels'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>766</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>767</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">options.lazyLoad</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>768</span> </span><span class="WHIT">	            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">items</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="STRN">'reload'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>769</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>770</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">options.active</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>771</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'option'</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>772</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getUnloadedUrl</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>773</span> </span><span class="WHIT">                </span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'open'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>774</span> </span><span class="WHIT">                </span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">"reload"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>775</span> </span><span class="WHIT">                </span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>776</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>777</span> </span><span class="WHIT">	        </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">--</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>778</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>779</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>780</span> </span><span class="WHIT">	                </span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'open'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>781</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>782</span> </span><span class="WHIT">	                </span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'close'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>783</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>784</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>785</span> </span><span class="WHIT">	        </span><span class="NAME">$self.css</span><span class="PUNC">(</span><span class="STRN">'height'</span><span class="PUNC">,</span><span class="NAME">$self.height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>786</span> </span><span class="WHIT">	        </span><span class="NAME">$self.css</span><span class="PUNC">(</span><span class="STRN">'height'</span><span class="PUNC">,</span><span class="NAME">options.height</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>787</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>788</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>789</span> </span><span class="WHIT">		</span><span class="NAME">_buildEvent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>790</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">that</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>791</span> </span><span class="WHIT">	        	</span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>792</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>793</span> </span><span class="WHIT">	            </span><span class="NAME">$closeIcon</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers a.om-icon-close'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>794</span> </span><span class="WHIT">	        </span><span class="COMM">//close icon</span><span class="WHIT">
<span class='line'>795</span> </span><span class="WHIT">	        </span><span class="NAME">$closeIcon.unbind</span><span class="PUNC">(</span><span class="STRN">'click.omtabs'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>796</span> </span><span class="WHIT">	            </span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">'click.omtabs'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>797</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tabid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">e.target</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">prev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>798</span> </span><span class="WHIT">	            </span><span class="NAME">that._close</span><span class="PUNC">(</span><span class="NAME">tabid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>799</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>800</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>801</span> </span><span class="WHIT">	        </span><span class="COMM">// tab click</span><span class="WHIT">
<span class='line'>802</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$tabInner</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>803</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.switchMode.indexOf</span><span class="PUNC">(</span><span class="STRN">'mouseover'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>804</span> </span><span class="WHIT">	        	</span><span class="NAME">$tabInner.bind</span><span class="PUNC">(</span><span class="STRN">'mouseover.omtabs'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>805</span> </span><span class="WHIT">	                 </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.data</span><span class="PUNC">(</span><span class="NAME">$self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'activateTimer'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>806</span> </span><span class="WHIT">	                </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">timer</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="STRN">'undefined'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">clearTimeout</span><span class="PUNC">(</span><span class="NAME">timer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>807</span> </span><span class="WHIT">	                </span><span class="NAME">timer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>808</span> </span><span class="WHIT">	                    </span><span class="NAME">that._activate</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>809</span> </span><span class="WHIT">	                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>810</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="NUMB">100</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>811</span> </span><span class="WHIT">	                </span><span class="NAME">$.data</span><span class="PUNC">(</span><span class="NAME">$self</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'activateTimer'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">timer</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>812</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>813</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.switchMode.indexOf</span><span class="PUNC">(</span><span class="STRN">'click'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>814</span> </span><span class="WHIT">	        	</span><span class="NAME">$tabInner.bind</span><span class="PUNC">(</span><span class="STRN">'click.omtabs'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>815</span> </span><span class="WHIT">	                </span><span class="NAME">that._activate</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>816</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>817</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>818</span> </span><span class="WHIT">	        </span><span class="NAME">$tabInner.bind</span><span class="PUNC">(</span><span class="STRN">'click.omtabs'</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>819</span> </span><span class="WHIT">	        	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>820</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>821</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.autoPlay</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>822</span> </span><span class="WHIT">	            </span><span class="NAME">options.autoInterId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">setInterval</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>823</span> </span><span class="WHIT">	                </span><span class="NAME">$self.omTabs</span><span class="PUNC">(</span><span class="STRN">'activate'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'next'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>824</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options.interval</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>825</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>826</span> </span><span class="WHIT">	            </span><span class="NAME">clearInterval</span><span class="PUNC">(</span><span class="NAME">options.autoInterId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>827</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>828</span> </span><span class="WHIT">	        </span><span class="COMM">//tab hover</span><span class="WHIT">
<span class='line'>829</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">options.switchMode.indexOf</span><span class="PUNC">(</span><span class="STRN">"mouseover"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>830</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$lis</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers li'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>831</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">addState</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">state</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$el</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>832</span> </span><span class="WHIT">	                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">$el.is</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">":not(.om-state-disabled)"</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>833</span> </span><span class="WHIT">	                    </span><span class="NAME">$el.addClass</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"om-state-"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">state</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>834</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>835</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>836</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">removeState</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">state</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$el</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>837</span> </span><span class="WHIT">	                </span><span class="NAME">$el.removeClass</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"om-state-"</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">state</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>838</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>839</span> </span><span class="WHIT">	            </span><span class="NAME">$lis.bind</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"mouseover.omtabs"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>840</span> </span><span class="WHIT">	                </span><span class="NAME">addState</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"hover"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>841</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>842</span> </span><span class="WHIT">	            </span><span class="NAME">$lis.bind</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"mouseout.omtabs"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>843</span> </span><span class="WHIT">	                </span><span class="NAME">removeState</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="STRN">"hover"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>844</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>845</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.closable</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">options.tabMenu</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>846</span> </span><span class="WHIT">	            	</span><span class="NAME">$lis.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>847</span> </span><span class="WHIT">	            		</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">item</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">"contextmenu"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>848</span> </span><span class="WHIT">			            	 </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$.fn.omMenu</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>849</span> </span><span class="WHIT">			            		 </span><span class="NAME">that.$currentLi</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>850</span> </span><span class="WHIT">			            		 </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">that.menu</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">omMenu</span><span class="PUNC">(</span><span class="STRN">'show'</span><span class="PUNC">,</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>851</span> </span><span class="WHIT">			            	 </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>852</span> </span><span class="WHIT">			            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>853</span> </span><span class="WHIT">	            	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>854</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>855</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>856</span> </span><span class="WHIT">	        </span><span class="COMM">//scroller click</span><span class="WHIT">
<span class='line'>857</span> </span><span class="WHIT">	        </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers >span'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">bind</span><span class="PUNC">(</span><span class="STRN">'click.omtabs'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>858</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scroll-disabled'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>859</span> </span><span class="WHIT">	                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>860</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>861</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">dist</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">'ul'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="STRN">'li:last'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">outerWidth</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>862</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scroll-left'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>863</span> </span><span class="WHIT">	                </span><span class="NAME">that._scroll</span><span class="PUNC">(</span><span class="NAME">dist</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">that._scrollCbFn</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>864</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>865</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scroll-right'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>866</span> </span><span class="WHIT">	                </span><span class="NAME">that._scroll</span><span class="PUNC">(</span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">dist</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">that._scrollCbFn</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>867</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>868</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>869</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>870</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>871</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'>872</span> </span><span class="WHIT">    	</span><span class="COMM">//remove every events.</span><span class="WHIT">
<span class='line'>873</span> </span><span class="WHIT">		</span><span class="NAME">_purgeEvent</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>874</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>875</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>876</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$headers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>877</span> </span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>878</span> </span><span class="WHIT">	        </span><span class="NAME">$headers.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">unbind</span><span class="PUNC">(</span><span class="STRN">'.omtabs'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>879</span> </span><span class="WHIT">	        </span><span class="NAME">$headers.find</span><span class="PUNC">(</span><span class="STRN">'>ul >li >a'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">unbind</span><span class="PUNC">(</span><span class="STRN">'.omtabs'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>880</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.autoInterId</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>881</span> </span><span class="WHIT">	            </span><span class="NAME">clearInterval</span><span class="PUNC">(</span><span class="NAME">options.autoInterId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>882</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>883</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>884</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>885</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>886</span> 	     * 选中特定的页签
<span class='line'>887</span> 	     * n 可为页签的索引（从0开始计数），或者页签的tabId TODO n 需要支持first  和 last 表示选中第一个和最后一个
<span class='line'>888</span> 	     */</span><span class="WHIT">
<span class='line'>889</span> </span><span class="WHIT">     	</span><span class="NAME">_activate</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>890</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>891</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>892</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>893</span> </span><span class="WHIT">	            </span><span class="NAME">url</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>894</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers ul'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>895</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">options.activeTabId</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>896</span> </span><span class="WHIT">	               </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>897</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>898</span> </span><span class="WHIT">	        </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>899</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$anchor</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>900</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'next'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>901</span> </span><span class="WHIT">	            </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>902</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'prev'</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>903</span> </span><span class="WHIT">	            </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">%</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>904</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>905</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>906</span> </span><span class="WHIT">	            </span><span class="NAME">tid</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>907</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>908</span> </span><span class="WHIT">	            </span><span class="NAME">n</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>909</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>910</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.onBeforeActivate</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeActivate"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">n</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>911</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>912</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>913</span> </span><span class="WHIT">	        </span><span class="NAME">$anchor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.find</span><span class="PUNC">(</span><span class="STRN">'li a[tabId='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">']'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>914</span> </span><span class="WHIT">	        </span><span class="NAME">$anchor.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="NAME">activatedCls</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>915</span> </span><span class="WHIT">	            </span><span class="PUNC">.</span><span class="NAME">siblings</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">removeClass</span><span class="PUNC">(</span><span class="NAME">activatedCls</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>916</span> </span><span class="WHIT">	        </span><span class="NAME">options.activeTabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>917</span> </span><span class="WHIT">	        </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">n</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>918</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>919</span> </span><span class="WHIT">	        </span><span class="COMM">// 保证切换面板时先显示后隐藏，防止页面抖动的现象</span><span class="WHIT">
<span class='line'>920</span> </span><span class="WHIT">	        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">--</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">>=</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>921</span> </span><span class="WHIT">	        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>922</span> </span><span class="WHIT">	        	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'option'</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>923</span> </span><span class="WHIT">	        		</span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'open'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>924</span> </span><span class="WHIT">	        		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">=</span><span class="NAME">this._getUnloadedUrl</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>925</span> </span><span class="WHIT">	        			</span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">"reload"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>926</span> </span><span class="WHIT">	        			</span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>927</span> </span><span class="WHIT">	        		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>928</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>929</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>930</span> </span><span class="WHIT">	        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">--</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">>=</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>931</span> </span><span class="WHIT">	        	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>932</span> </span><span class="WHIT">	        	</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'option'</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>933</span> </span><span class="WHIT">	        		</span><span class="NAME">$target.omPanel</span><span class="PUNC">(</span><span class="STRN">'close'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>934</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>935</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>936</span> </span><span class="WHIT">	        </span><span class="COMM">//当选中了一个并未完全显示的页签,需要滚动让他完全显示出来</span><span class="WHIT">
<span class='line'>937</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">this._checkScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>938</span> </span><span class="WHIT">	            </span><span class="COMM">//stop every animation.</span><span class="WHIT">
<span class='line'>939</span> </span><span class="WHIT">	            </span><span class="NAME">$ul.stop</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>940</span> </span><span class="WHIT">	            </span><span class="NAME">$self.clearQueue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>941</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$lScroller</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.prev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>942</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$rScroller</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>943</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lBorder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$anchor.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>944</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">rBorder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">lBorder</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">$anchor.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">outerWidth</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>945</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">lDiff</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$lScroller.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">$lScroller.outerWidth</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">lBorder</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>946</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">rDiff</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$rScroller.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">rBorder</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>947</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">lDiff</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>948</span> </span><span class="WHIT">	                </span><span class="NAME">this._scroll</span><span class="PUNC">(</span><span class="NAME">lDiff</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._scrollCbFn</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>949</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">rDiff</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>950</span> </span><span class="WHIT">	                </span><span class="NAME">this._scroll</span><span class="PUNC">(</span><span class="NAME">rDiff</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._scrollCbFn</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>951</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>952</span> </span><span class="WHIT">	                </span><span class="NAME">this._scrollCbFn</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>953</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>954</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>955</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">his</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.history</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>956</span> </span><span class="WHIT">	        	</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.inArray</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">his</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>957</span> </span><span class="WHIT">	        </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">his.push</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">his.push</span><span class="PUNC">(</span><span class="NAME">his.splice</span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>958</span> </span><span class="WHIT">	        </span><span class="NAME">options.onActivate</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onActivate"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">n</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>959</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>960</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>961</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>962</span>     	 * 如果对应的tab已经加载过了，返回null,否则返回指定tab的url
<span class='line'>963</span>     	 */</span><span class="WHIT">
<span class='line'>964</span> </span><span class="WHIT">		</span><span class="NAME">_getUnloadedUrl</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>965</span> </span><span class="WHIT">    		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">infos</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.loadInfo</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>966</span> </span><span class="WHIT">    		</span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">infos</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>967</span> </span><span class="WHIT">    		    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">infos</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">infos</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">loaded</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>968</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">infos</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">url</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>969</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>970</span> </span><span class="WHIT">    		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>971</span> </span><span class="WHIT">    	 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>972</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>973</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'>974</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>975</span> 		 * 把对应的tab的loadInfo信息删除掉
<span class='line'>976</span> 		 */</span><span class="WHIT">
<span class='line'>977</span> </span><span class="WHIT">		</span><span class="NAME">_removeLoadInfo</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>978</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">loadInfo</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.loadInfo</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>979</span> </span><span class="WHIT">    			</span><span class="NAME">len</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>980</span> </span><span class="WHIT">    			</span><span class="NAME">info</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>981</span> </span><span class="WHIT">    		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">loadInfo</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>982</span> </span><span class="WHIT">    			</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">loadInfo.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>983</span> </span><span class="WHIT">    			</span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">info</span><span class="PUNC">=</span><span class="NAME">loadInfo</span><span class="PUNC">[</span><span class="PUNC">--</span><span class="NAME">len</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>984</span> </span><span class="WHIT">    				</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">info.tabId</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">tid</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>985</span> </span><span class="WHIT">    					</span><span class="NAME">loadInfo.splice</span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>986</span> </span><span class="WHIT">    					</span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>987</span> </span><span class="WHIT">    				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>988</span> </span><span class="WHIT">    			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>989</span> </span><span class="WHIT">    		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>990</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>991</span> </span><span class="WHIT">		</span><span class="WHIT">
<span class='line'>992</span> </span><span class="WHIT">		</span><span class="COMM">/**
<span class='line'>993</span> 		 * 添加对应的tab的loadInfo信息
<span class='line'>994</span> 		 */</span><span class="WHIT">
<span class='line'>995</span> </span><span class="WHIT">		</span><span class="NAME">_addLoadInfo</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>996</span> </span><span class="WHIT">			</span><span class="NAME">this.loadInfo.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>997</span> </span><span class="WHIT">				</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>998</span> </span><span class="WHIT">				</span><span class="NAME">loaded</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>999</span> </span><span class="WHIT">				</span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT">
<span class='line'>1000</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1001</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1002</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>1003</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1004</span> 	     * 页签索引和tabId的转换器。
<span class='line'>1005</span> 	     * 如果传入的id为数字，则表示页签的索引，函数返回页签的tabId；如果id为字符串，则表示该页签的tabId，函数返回页签的索引。
<span class='line'>1006</span> 	     */</span><span class="WHIT">
<span class='line'>1007</span> </span><span class="WHIT">		</span><span class="NAME">_getAlter</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1008</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1009</span> </span><span class="WHIT">	            </span><span class="NAME">rt</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1010</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'number'</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1011</span> </span><span class="WHIT">	            </span><span class="NAME">rt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers li:eq('</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">') a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1012</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1013</span> </span><span class="WHIT">	            </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers li a.om-tabs-inner'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1014</span> </span><span class="WHIT">	                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="STRN">'tabId'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1015</span> </span><span class="WHIT">	                    </span><span class="NAME">rt</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1016</span> </span><span class="WHIT">	                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1017</span> </span><span class="WHIT">	                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1018</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1019</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1020</span> </span><span class="WHIT">	        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">rt</span><span class="PUNC">===</span><span class="NAME">undefined</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">rt</span><span class="PUNC">;</span><span class="COMM">//如果找不到要返回null,而不是undefined,这源于om-core.js中对于返回undefined，最终会返回组件实例</span><span class="WHIT">
<span class='line'>1021</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1022</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1023</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1024</span> 	     * 返回当前选中的页签的tabId
<span class='line'>1025</span> 	     */</span><span class="WHIT">
<span class='line'>1026</span> </span><span class="WHIT">    	</span><span class="NAME">_getActivated</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1027</span> </span><span class="WHIT">			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.options.activeTabId</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1028</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1029</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1030</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1031</span> 	     * 增加一个tab到页签布局中.最后一个参数isAjax指示了ds是否为一个URL
<span class='line'>1032</span> 	     */</span><span class="WHIT">
<span class='line'>1033</span> </span><span class="WHIT">    	</span><span class="NAME">_add</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">config</span><span class="COMM">/*title, content, url, closable , index, tabId, activateNew */</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1034</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1035</span> </span><span class="WHIT">	        	</span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1036</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1037</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1038</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers ul'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1039</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.tabId</span><span class="PUNC">?</span><span class="NAME">config.tabId</span><span class="PUNC">:</span><span class="NAME">tabIdPrefix</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">++</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1040</span> </span><span class="WHIT">	        </span><span class="COMM">//调整参数</span><span class="WHIT">
<span class='line'>1041</span> </span><span class="WHIT">	        </span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'last'</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1042</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'last'</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1043</span> </span><span class="WHIT">	            </span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1044</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1045</span> </span><span class="WHIT">	        </span><span class="NAME">config.title</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.title</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'New Title '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1046</span> </span><span class="WHIT">	        </span><span class="NAME">config.url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.trim</span><span class="PUNC">(</span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1047</span> </span><span class="WHIT">	        </span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.trim</span><span class="PUNC">(</span><span class="NAME">config.content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1048</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1049</span> </span><span class="WHIT">	            </span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1050</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1051</span> </span><span class="WHIT">	            </span><span class="NAME">config.url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1052</span> </span><span class="WHIT">	            </span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'New Content '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1053</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1054</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.onBeforeAdd</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">_self._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeAdd"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">config</span><span class="COMM">/*title, content, url, closable , index*/</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1055</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1056</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1057</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$nHeader</span><span class="PUNC">=</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;li class="om-state-default om-corner-top"> &lt;/li>'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1058</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$anchor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;a class="om-tabs-inner">&lt;/a>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">html</span><span class="PUNC">(</span><span class="NAME">config.title</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">attr</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1059</span> </span><span class="WHIT">	                </span><span class="NAME">href</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'#'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1060</span> </span><span class="WHIT">	                </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="WHIT">
<span class='line'>1061</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1062</span> </span><span class="WHIT">	                </span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">options.tabWidth</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1063</span> </span><span class="WHIT">	                </span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">options.tabHeight</span><span class="WHIT">
<span class='line'>1064</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">appendTo</span><span class="PUNC">(</span><span class="NAME">$nHeader</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1065</span> </span><span class="WHIT">	        </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="lileft">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertBefore</span><span class="PUNC">(</span><span class="NAME">$anchor</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1066</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isIE7</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1067</span> </span><span class="WHIT">	            </span><span class="NAME">$anchor.attr</span><span class="PUNC">(</span><span class="STRN">'hideFocus'</span><span class="PUNC">,</span><span class="STRN">'true'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1068</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1069</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">(</span><span class="NAME">config.closable</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>1070</span> </span><span class="WHIT">	                </span><span class="PUNC">(</span><span class="NAME">config.closable</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">options.closable</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1071</span> </span><span class="WHIT">	            </span><span class="NAME">$anchor.after</span><span class="PUNC">(</span><span class="STRN">'&lt;a class="om-icon om-icon-close">&lt;/a>'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1072</span> </span><span class="WHIT">	            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="liright">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$anchor.next</span><span class="PUNC">(</span><span class="STRN">'.om-icon-close'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1073</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1074</span> </span><span class="WHIT">	        	</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span class="liright">&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$anchor</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1075</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1076</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>1077</span> </span><span class="WHIT">			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cfg</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1078</span> </span><span class="WHIT">	            </span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1079</span> </span><span class="WHIT">	            </span><span class="NAME">title</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">$anchor.text</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1080</span> </span><span class="WHIT">	            </span><span class="NAME">_closeMode</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"visibility"</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1081</span> </span><span class="WHIT">	            </span><span class="NAME">header</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1082</span> </span><span class="WHIT">	            </span><span class="NAME">closed</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1083</span> </span><span class="WHIT">                </span><span class="NAME">onSuccess</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">textStatus</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">xmlHttpRequest</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1084</span> </span><span class="WHIT">    				</span><span class="NAME">_self._trigger</span><span class="PUNC">(</span><span class="STRN">"onLoadComplete"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1085</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1086</span> </span><span class="WHIT">	        	</span><span class="NAME">onError</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">xmlHttpRequest</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">textStatus</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">errorThrown</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1087</span> </span><span class="WHIT">	        		</span><span class="NAME">_self._trigger</span><span class="PUNC">(</span><span class="STRN">"onLoadComplete"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1088</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1089</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1090</span> </span><span class="WHIT">			</span><span class="NAME">$.extend</span><span class="PUNC">(</span><span class="NAME">cfg</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1091</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">config.url</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.lazyLoad</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">config.lazyLoad</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1092</span> </span><span class="WHIT">                </span><span class="NAME">_self.loadInfo.push</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1093</span> </span><span class="WHIT">                    </span><span class="NAME">tabId</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">tabId</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1094</span> </span><span class="WHIT">                    </span><span class="NAME">url</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">config.url</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1095</span> </span><span class="WHIT">                    </span><span class="NAME">loaded</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="WHIT">  </span><span class="WHIT">
<span class='line'>1096</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1097</span> </span><span class="WHIT">                </span><span class="NAME">cfg.url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1098</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>1099</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$nPanel</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">OmPanel</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;div>'</span><span class="PUNC">+</span><span class="PUNC">(</span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="STRN">'&lt;/div>'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">cfg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1100</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">items.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1101</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">config.index</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$nPanel</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1102</span> </span><span class="WHIT">	            </span><span class="NAME">$nHeader.insertBefore</span><span class="PUNC">(</span><span class="NAME">$ul.find</span><span class="PUNC">(</span><span class="STRN">'span.right-placeholder'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1103</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1104</span> </span><span class="WHIT">	            </span><span class="COMM">//insert at index</span><span class="WHIT">
<span class='line'>1105</span> </span><span class="WHIT">	            </span><span class="NAME">items.splice</span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$nPanel</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1106</span> </span><span class="WHIT">	            </span><span class="NAME">$ul.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">before</span><span class="PUNC">(</span><span class="NAME">$nHeader</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1107</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1108</span> </span><span class="WHIT">	        </span><span class="COMM">//om-tabs在添加很多个页签后，当页签头的宽度超过5000px的时候出现换行。所以这里进行宽度自动扩充</span><span class="WHIT">
<span class='line'>1109</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$ul.innerWidth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">-</span><span class="NAME">$nHeader.position</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">&lt;</span><span class="NUMB">500</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1110</span> </span><span class="WHIT">                </span><span class="NAME">$ul.width</span><span class="PUNC">(</span><span class="NAME">$ul.width</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">500</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1111</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1112</span> </span><span class="WHIT">	        </span><span class="COMM">//every time we add or close an tab, check if scroller is needed.</span><span class="WHIT">
<span class='line'>1113</span> </span><span class="WHIT">	        </span><span class="NAME">this._checkScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._enableScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1114</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>1115</span> </span><span class="WHIT">	        </span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">config.index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">"om-state-nobd"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT">  </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-panels'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1116</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>1117</span> </span><span class="WHIT">	        </span><span class="NAME">this._purgeEvent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1118</span> </span><span class="WHIT">	        </span><span class="NAME">this._buildEvent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1119</span> </span><span class="WHIT">	        </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onAdd"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">cfg</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1120</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="PUNC">(</span><span class="NAME">config.activateNew</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1121</span> </span><span class="WHIT">	            </span><span class="NAME">this._activate</span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1122</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1123</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1124</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1125</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1126</span> 	     * 将index处的页签关闭，并激活上一激活状态的页签页签，比如你激活顺序为1、2、4、3，关闭3之后将激活页签4
<span class='line'>1127</span> 	     * index :页签的位置，可为数字，tabId等。 //TODO index将要支持prev，  next， first， last
<span class='line'>1128</span> 	     */</span><span class="WHIT">
<span class='line'>1129</span> </span><span class="WHIT">    	</span><span class="NAME">_close</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1130</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1131</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1132</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1133</span> </span><span class="WHIT">	        	</span><span class="NAME">$headers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1134</span> </span><span class="WHIT">	        	</span><span class="NAME">$panels</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-panels'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1135</span> </span><span class="WHIT">	        	</span><span class="NAME">omtabsHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1136</span> </span><span class="WHIT">	        	</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">index</span><span class="PUNC">,</span><span class="COMM">//待关闭的tab的id</span><span class="WHIT">
<span class='line'>1137</span> </span><span class="WHIT">	        	</span><span class="NAME">his</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.history</span><span class="PUNC">;</span><span class="COMM">//页签打开历史记录</span><span class="WHIT">
<span class='line'>1138</span> </span><span class="WHIT">	        </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="PUNC">:</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1139</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1140</span> </span><span class="WHIT">	            </span><span class="COMM">//index is a tabid</span><span class="WHIT">
<span class='line'>1141</span> </span><span class="WHIT">	            </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1142</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1143</span> </span><span class="WHIT">	        	</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1144</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1145</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.onBeforeClose</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeClose"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">index</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1146</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1147</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1148</span> </span><span class="WHIT">	        </span><span class="COMM">//这里删除loadInfo是有必要的，因为也许该tab从来就没有激活过，但却是懒加载的</span><span class="WHIT">
<span class='line'>1149</span> </span><span class="WHIT">	        </span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1150</span> </span><span class="WHIT">	        </span><span class="NAME">$headers.find</span><span class="PUNC">(</span><span class="STRN">'li'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1151</span> </span><span class="WHIT">	        </span><span class="NAME">$panels.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">find</span><span class="PUNC">(</span><span class="STRN">">.om-panel-body"</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">eq</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">empty</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1152</span> </span><span class="WHIT">	        </span><span class="NAME">items.splice</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1153</span> </span><span class="WHIT">	        </span><span class="COMM">//in case of all tabs are closed, set body height</span><span class="WHIT">
<span class='line'>1154</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$panels.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1155</span> </span><span class="WHIT">	            </span><span class="NAME">$panels.css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">omtabsHeight</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">$headers.outerHeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1156</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1157</span> </span><span class="WHIT">	        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NAME">his.length</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">>=</span><span class="NUMB">0</span><span class="PUNC">;</span><span class="NAME">i</span><span class="PUNC">--</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1158</span> </span><span class="WHIT">	        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">his</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1159</span> </span><span class="WHIT">	        		</span><span class="NAME">his.splice</span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1160</span> </span><span class="WHIT">	        		</span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1161</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1162</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1163</span> </span><span class="WHIT">	        </span><span class="NAME">options.onClose</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onClose"</span><span class="PUNC">,</span><span class="KEYW">null</span><span class="PUNC">,</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1164</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">items.length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1165</span> </span><span class="WHIT">	            </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1166</span> </span><span class="WHIT">	            </span><span class="NAME">options.activeTabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1167</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1168</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1169</span> </span><span class="WHIT">	            </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1170</span> </span><span class="WHIT">	            </span><span class="NAME">this._activate</span><span class="PUNC">(</span><span class="NAME">his.length</span><span class="PUNC">></span><span class="NUMB">0</span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">his.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1171</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1172</span> </span><span class="WHIT">	            </span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">--</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1173</span> </span><span class="WHIT">	            </span><span class="NAME">this._checkScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._enableScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1174</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1175</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1176</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1177</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1178</span> 	     * 关闭所有页签，该操作会触发 closeAll事件
<span class='line'>1179</span> 	     */</span><span class="WHIT">
<span class='line'>1180</span> </span><span class="WHIT">     	</span><span class="NAME">_closeAll</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1181</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1182</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1183</span> </span><span class="WHIT">	            </span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1184</span> </span><span class="WHIT">	        	</span><span class="NAME">$headers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1185</span> </span><span class="WHIT">	        	</span><span class="NAME">$panels</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-panels'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1186</span> </span><span class="WHIT">	        	</span><span class="NAME">omtabsHeight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1187</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>1188</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.onBeforeCloseAll</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onBeforeCloseAll"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1189</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1190</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1191</span> </span><span class="WHIT">	        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">=</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">len</span><span class="PUNC">=</span><span class="NAME">items.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">&lt;</span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1192</span> </span><span class="WHIT">	        	</span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="STRN">"option"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"tabId"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1193</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1194</span> </span><span class="WHIT">	        </span><span class="NAME">$headers.find</span><span class="PUNC">(</span><span class="STRN">'li'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1195</span> </span><span class="WHIT">	        </span><span class="NAME">$panels.empty</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1196</span> </span><span class="WHIT">	        </span><span class="NAME">items.splice</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">items.length</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1197</span> </span><span class="WHIT">	        </span><span class="NAME">$panels.css</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">omtabsHeight</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">$headers.outerHeight</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1198</span> </span><span class="WHIT">	        </span><span class="NAME">options.active</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1199</span> </span><span class="WHIT">	        </span><span class="NAME">options.activeTabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1200</span> </span><span class="WHIT">	        </span><span class="NAME">this.history</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1201</span> </span><span class="WHIT">	        </span><span class="NAME">options.onCloseAll</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._trigger</span><span class="PUNC">(</span><span class="STRN">"onCloseAll"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1202</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1203</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1204</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1205</span> 	     * 如果tab页签总宽度较大，则显示scroll并返回true；否则删除scroll并返回false。
<span class='line'>1206</span> 	     */</span><span class="WHIT">
<span class='line'>1207</span> </span><span class="WHIT">     	</span><span class="NAME">_checkScroller</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1208</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1209</span> </span><span class="WHIT">	            </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1210</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">options.scrollable</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1211</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1212</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1213</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers ul'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1214</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">totalWidth</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">4</span><span class="PUNC">;</span><span class="WHIT">  </span><span class="COMM">// padding</span><span class="WHIT">
<span class='line'>1215</span> </span><span class="WHIT">	        </span><span class="NAME">$ul.children</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1216</span> </span><span class="WHIT">	            </span><span class="COMM">//计算一个li占用的总宽度</span><span class="WHIT">
<span class='line'>1217</span> </span><span class="WHIT">	            </span><span class="NAME">totalWidth</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">outerWidth</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="COMM">//sub element's width</span><span class="WHIT">
<span class='line'>1218</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1219</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">totalWidth</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NAME">$ul.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">innerWidth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1220</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">$ul.hasClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scrollable'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1221</span> </span><span class="WHIT">	                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$leftScr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span>&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertBefore</span><span class="PUNC">(</span><span class="NAME">$ul</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scroll-left'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1222</span> </span><span class="WHIT">	                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$rightScr</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'&lt;span>&lt;/span>'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">insertAfter</span><span class="PUNC">(</span><span class="NAME">$ul</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">addClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scroll-right'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1223</span> </span><span class="WHIT">	                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mgn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">$ul.height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">$leftScr.height</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">/</span><span class="NUMB">2</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1224</span> </span><span class="WHIT">	              </span><span class="COMM">/*  $leftScr.add($rightScr).css({ // scroller in vertical center.
<span class='line'>1225</span> 	                    'marginTop' : mgn,
<span class='line'>1226</span> 	                    'marginBottom' : mgn
<span class='line'>1227</span> 	                });*/</span><span class="WHIT">
<span class='line'>1228</span> </span><span class="WHIT">	                </span><span class="NAME">$ul.addClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scrollable'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1229</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1230</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1231</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1232</span> </span><span class="WHIT">	            </span><span class="NAME">$ul.removeClass</span><span class="PUNC">(</span><span class="STRN">'om-tabs-scrollable'</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>1233</span> </span><span class="WHIT">	                </span><span class="PUNC">.</span><span class="NAME">siblings</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">remove</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1234</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1235</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1236</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1237</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1238</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1239</span> 	     * 一般滚动之后都需要执行回调_enableScroller设置滚动条的状态，现包装成方法。
<span class='line'>1240</span> 	     */</span><span class="WHIT">
<span class='line'>1241</span> </span><span class="WHIT">    	</span><span class="NAME">_scrollCbFn</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1242</span> </span><span class="WHIT">    		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">that</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1243</span> </span><span class="WHIT">	        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1244</span> </span><span class="WHIT">	            </span><span class="NAME">that._enableScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1245</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1246</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1247</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1248</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1249</span> 	     * 根据页签的位置，设置scroller的状态。
<span class='line'>1250</span> 	     * 当最右边的页签顶住组件右边沿，则右边的scroller应该禁用，表示不能再往右滚动了。
<span class='line'>1251</span> 	     * 当最左边的页签顶住组件左边沿，则左边的scroller应该禁用，表示不能再往左滚动了。
<span class='line'>1252</span> 	     */</span><span class="WHIT">
<span class='line'>1253</span> </span><span class="WHIT">     	</span><span class="NAME">_enableScroller</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1254</span> </span><span class="WHIT">	       	</span><span class="KEYW">var</span><span class="WHIT">	</span><span class="NAME">$headers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1255</span> </span><span class="WHIT">	        	</span><span class="NAME">$ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$headers.children</span><span class="PUNC">(</span><span class="STRN">'ul'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1256</span> </span><span class="WHIT">	        	</span><span class="NAME">$lScroller</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.prev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1257</span> </span><span class="WHIT">	        	</span><span class="NAME">$rScroller</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1258</span> </span><span class="WHIT">	        	</span><span class="NAME">$li</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.children</span><span class="PUNC">(</span><span class="STRN">':last'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1259</span> </span><span class="WHIT">	        	</span><span class="NAME">lBorder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$headers.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1260</span> </span><span class="WHIT">	            </span><span class="NAME">rBorder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$rScroller.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1261</span> </span><span class="WHIT">	            </span><span class="NAME">ulLeft</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1262</span> </span><span class="WHIT">	            </span><span class="NAME">ulRight</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$li.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">$li.outerWidth</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1263</span> </span><span class="WHIT">	        </span><span class="WHIT">
<span class='line'>1264</span> </span><span class="WHIT">	            </span><span class="NAME">$lScroller.toggleClass</span><span class="PUNC">(</span><span class="NAME">scrollDisabled</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' om-tabs-scroll-disabled-left'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ulLeft</span><span class="WHIT"> </span><span class="PUNC">>=</span><span class="WHIT"> </span><span class="NAME">lBorder</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1265</span> </span><span class="WHIT">	            </span><span class="NAME">$rScroller.toggleClass</span><span class="PUNC">(</span><span class="NAME">scrollDisabled</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">' om-tabs-scroll-disabled-right'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ulRight</span><span class="WHIT"> </span><span class="PUNC">&lt;=</span><span class="WHIT"> </span><span class="NAME">rBorder</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1266</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1267</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1268</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1269</span> 	     * 将页签头部往右边滑动distance的距离。当distance为负数时，表示往左边滑动；fn为回调函数
<span class='line'>1270</span> 	     */</span><span class="WHIT">
<span class='line'>1271</span> </span><span class="WHIT">     	</span><span class="NAME">_scroll</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">distance</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1272</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">_self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1273</span> </span><span class="WHIT">	            </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1274</span> </span><span class="WHIT">	        	</span><span class="NAME">$ul</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$self.find</span><span class="PUNC">(</span><span class="STRN">'>div.om-tabs-headers ul'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1275</span> </span><span class="WHIT">	        	</span><span class="NAME">$li</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$ul.children</span><span class="PUNC">(</span><span class="STRN">':last'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1276</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1277</span> </span><span class="WHIT">	            </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1278</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1279</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">scrOffset</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">$ul.prev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">$ul.next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1280</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">queuedFn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">next</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1281</span> </span><span class="WHIT">	            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$ul.prev</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="NAME">scrollDisabled</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>1282</span> </span><span class="WHIT">	                    </span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">$ul.next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">hasClass</span><span class="PUNC">(</span><span class="NAME">scrollDisabled</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1283</span> </span><span class="WHIT">	                </span><span class="NAME">$ul.stop</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1284</span> </span><span class="WHIT">	                </span><span class="NAME">$self.clearQueue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1285</span> </span><span class="WHIT">	                </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1286</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1287</span> </span><span class="WHIT">	            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">flag</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1288</span> </span><span class="WHIT">	            </span><span class="COMM">//fix distance.</span><span class="WHIT">
<span class='line'>1289</span> </span><span class="WHIT">	            </span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">'+='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">Math.min</span><span class="PUNC">(</span><span class="NAME">scrOffset.left</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">$ul.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">distance</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>1290</span> </span><span class="WHIT">	                </span><span class="STRN">'-='</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">Math.min</span><span class="PUNC">(</span><span class="NAME">$li.offset</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">$li.outerWidth</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NAME">scrOffset.left</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Math.abs</span><span class="PUNC">(</span><span class="NAME">distance</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1291</span> </span><span class="WHIT">	            </span><span class="NAME">_self.isScrolling</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1292</span> </span><span class="WHIT">	            </span><span class="NAME">$ul.animate</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1293</span> </span><span class="WHIT">	                </span><span class="NAME">left</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">distance</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'px'</span><span class="WHIT">
<span class='line'>1294</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="STRN">'normal'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'swing'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1295</span> </span><span class="WHIT">	                </span><span class="PUNC">!</span><span class="PUNC">!</span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1296</span> </span><span class="WHIT">	                </span><span class="NAME">_self.isScrolling</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1297</span> </span><span class="WHIT">	                </span><span class="NAME">next</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1298</span> </span><span class="WHIT">	            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1299</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1300</span> </span><span class="WHIT">	        </span><span class="NAME">$self.queue</span><span class="PUNC">(</span><span class="NAME">queuedFn</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1301</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">$self.queue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="WHIT">
<span class='line'>1302</span> </span><span class="WHIT">	                </span><span class="PUNC">!</span><span class="NAME">_self.isScrolling</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1303</span> </span><span class="WHIT">	            </span><span class="NAME">$self.dequeue</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//start queue</span><span class="WHIT">
<span class='line'>1304</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1305</span> </span><span class="WHIT">    	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1306</span> </span><span class="WHIT">    	</span><span class="WHIT">
<span class='line'>1307</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1308</span> 	     * 获得当前所有页签的数目
<span class='line'>1309</span> 	     */</span><span class="WHIT">
<span class='line'>1310</span> </span><span class="WHIT">	    </span><span class="NAME">_getLength</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1311</span> </span><span class="WHIT">	        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.items.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1312</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1313</span> </span><span class="WHIT">	    </span><span class="WHIT">
<span class='line'>1314</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1315</span> 	     * 重新计算omTabs布局
<span class='line'>1316</span> 	     */</span><span class="WHIT">
<span class='line'>1317</span> </span><span class="WHIT">	    </span><span class="NAME">_doLayout</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1318</span> </span><span class="WHIT">	        </span><span class="NAME">this._checkScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">this._enableScroller</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1319</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1320</span> </span><span class="WHIT">	    </span><span class="WHIT">
<span class='line'>1321</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1322</span> 	     * 设置第config.index个页签的数据源，如果设置了cofnig.url，则数据源为远程数据，如果设置了config.content数据源为普通文本。
<span class='line'>1323</span> 	     */</span><span class="WHIT">
<span class='line'>1324</span> </span><span class="WHIT">	    </span><span class="NAME">_setDataSource</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">config</span><span class="WHIT"> </span><span class="COMM">/*content, url, index*/</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1325</span> </span><span class="WHIT">	        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1326</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1327</span> </span><span class="WHIT">	        	</span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.options</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1328</span> </span><span class="WHIT">	        	</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">config.index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1329</span> </span><span class="WHIT">	        </span><span class="NAME">config.url</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.trim</span><span class="PUNC">(</span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1330</span> </span><span class="WHIT">	        </span><span class="NAME">config.content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.trim</span><span class="PUNC">(</span><span class="NAME">config.content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1331</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1332</span> </span><span class="WHIT">	        	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">options.lazyLoad</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1333</span> </span><span class="WHIT">	        		</span><span class="NAME">this._addLoadInfo</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1334</span> </span><span class="WHIT">	        		</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">config.index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="STRN">"option"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"url"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">	       </span><span class="WHIT">
<span class='line'>1335</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1336</span> </span><span class="WHIT">	        		</span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1337</span> </span><span class="WHIT">					</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">config.index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="STRN">"reload"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config.url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">					 		</span><span class="WHIT">
<span class='line'>1338</span> </span><span class="WHIT">	        	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1339</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1340</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">config.index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">html</span><span class="PUNC">(</span><span class="NAME">config.content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1341</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1342</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1343</span> </span><span class="WHIT">	    </span><span class="WHIT">
<span class='line'>1344</span> </span><span class="WHIT">	    </span><span class="COMM">/**
<span class='line'>1345</span> 	     * 重新加载第n个页签的内容
<span class='line'>1346</span> 	     */</span><span class="WHIT">
<span class='line'>1347</span> </span><span class="WHIT">	    </span><span class="NAME">_reload</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">index</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">content</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1348</span> </span><span class="WHIT">	    	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.element</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1349</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.items</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>1350</span> </span><span class="WHIT">	        	</span><span class="NAME">tabId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._getAlter</span><span class="PUNC">(</span><span class="NAME">index</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1351</span> </span><span class="WHIT">	        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1352</span> </span><span class="WHIT">	        	</span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1353</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="STRN">"reload"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">	</span><span class="WHIT">
<span class='line'>1354</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>1355</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">html</span><span class="PUNC">(</span><span class="NAME">content</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1356</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="COMM">//只传了索引</span><span class="WHIT">
<span class='line'>1357</span> </span><span class="WHIT">	        	</span><span class="COMM">//case1:如果一个页签还未加载过，则omPanel中并不会保存其url,所以这里必须再传一个url给omPanel。</span><span class="WHIT">
<span class='line'>1358</span> </span><span class="WHIT">	        	</span><span class="COMM">//case2:页签如果已经加载过了，那么传给omPanel的url将会是null,这将会正常重新加载。</span><span class="WHIT">
<span class='line'>1359</span> </span><span class="WHIT">	        	</span><span class="NAME">items</span><span class="PUNC">[</span><span class="NAME">index</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">omPanel</span><span class="PUNC">(</span><span class="STRN">"reload"</span><span class="WHIT"> </span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">this._getUnloadedUrl</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1360</span> </span><span class="WHIT">	        	</span><span class="NAME">this._removeLoadInfo</span><span class="PUNC">(</span><span class="NAME">tabId</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1361</span> </span><span class="WHIT">	        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1362</span> </span><span class="WHIT">	    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>1363</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>1364</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="NAME">jQuery</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>